<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Off the Record</title>
<script type="text/javascript">
	function addMentor() {
		var companyName = $('#company_name').val();
		var id = $('#userId').val();
		$.ajax({
			type: "post",
			url: "/OffTheRecord/addMentor.action",
			data: "companyName="+companyName+"&&userId="+id,
			dataType:"json",
			
			success:function(data){
				if(data.flag == 0){
					$('#company_name').val('');
					$('#userId').val('');
					alert("멘토 추가 성공");
				}
				else if(data.flag == 1){
					$('#company_name').val('');
					$('#userId').val('');
					alert("기업이 없습니다.");
				}
				else if(data.flag == 2){
					$('#company_name').val('');
					$('#userId').val('');
					alert("user가 존재하지 않습니다.");
				}
				else{
					$('#company_name').val('');
					$('#userId').val('');
					alert("user가 해당기업의 Mentor입니다.");
				}
			}
		});//ajax */
	}
</script>
</head>
<body>
	<c:import url="../common/top.jsp"></c:import>
	<div class="container" style="margin: 60px;"></div>

	<div class="container">
		<div class="row">
			<div class="col-xs-1 col-sm-1 col-md-1 col-lg-1"></div>
			<!--  -->

			<div class="col-sm-10 col-md-10 col-lg-10">
				<div class="col-3-sm col-sm-3 col-md-3 col-3-lg">
					<c:import url="admin_menu.jsp" />
				</div>


				<div class="bs-example col-sm-9 col-md-9 col-lg-9">
				
	<!-- 탭 -->
	<div class="bs-example bs-example-tabs" role="tabpanel">
		<ul id="myTab" class="nav nav-tabs" role="tablist">
			<li role="presentation" class="active"><a href="#home" id="home-tab" role="tab" data-toggle="tab" aria-controls="home" aria-expanded="true">멘토 추가 <span class="glyphicon glyphicon-user"></a></li>
	  	</ul>
	    
	    <div id="myTabContent" class="tab-content">
			<div role="tabpanel" class="tab-pane fade in active" id="home" aria-labelledBy="home-tab">
		   			
			<div class="user-update col-lg-12" style="padding: 10px;">
			<!--  -->				
				<div class="form-group">
					<label for="company_name">기업 명</label>
					<input list="companyName" class="form-control" placeholder="멘토를 추가하실 기업 명을 입력해주세요" name="companyName" id="company_name">
					<datalist id="companyName">
						<c:forEach items="${clist }" var="clist">
							<option id="clist" value="${clist.companyName}">
						</c:forEach>
					</datalist>
				</div>

					<div class="form-group">
						<label for="company_salary">회원 아이디</label>
							<input type="text" class="form-control" placeholder="기업에 추가하실 회원 아이디를 입력해주세요" id="userId">
					</div>
					
					<div class="" style="padding-top: 10px;
					">
						<button type="button" onclick="addMentor()" class="btn btn-default">멘토 추가</button>
					</div>
				</div>
				
							<!--  -->
			</div>
						
			</div>
		</div>
	</div><!-- End 탭 -->
				
				
				
				
				
				
				
				
				
			</div>
			<!--  -->
			<div class="col-xs-1 col-sm-1 col-md-1 col-lg-1"></div>
		</div>
		<!-- row -->
	</div>
	<!-- container -->

	<script
		src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
	<script
		src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
</body>
</html>